import { createStore } from "vuex";

export default createStore({
  state: {
    userInfo: JSON.parse(localStorage.getItem("userInfo") as string) || {},
    loginStatus:
      JSON.parse(localStorage.getItem("loginStatus") as string) || "false",
    token: localStorage.getItem("token") || "",
    confirmDate: "onConfirm",
    depid:'',
    id:'',
    keshi: ""
  },

  getters: {},
  mutations: {
    setkesshi(state, keshi) {
      state.keshi = keshi;
    },
    setUserInfo(state, userInfo) {
      state.userInfo = userInfo;
    },
    //清除state数据
    clear(state) {
      (state.userInfo = {}), (state.loginStatus = "false"), (state.token = "");
    },
  },

  actions: {},
  modules: {},
});
